import request from '@/utils/request'
// import qs from 'qs'

// 组播路由

// 获取组播路由列表
export function routeMulticastArray (params) {
  var data = fromData(params)
  return request({
    url: 'multicast/routeMulticastArray',
    method: 'post',
    data
  })
}

// 删除组播路由
export function delRouteMulticast (params) {
  var data = fromData(params)
  return request({
    url: 'multicast/del_route_multicast',
    method: 'post',
    data
  })
}

// 添加组播路由
export function addRouteMulticast (params) {
  var data = fromData(params)
  return request({
    url: 'multicast/addRouteMulticast',
    method: 'post',
    data
  })
}

function fromData (params) {
  let formData = new FormData()
  for (const it in params) {
    if (!Object.is(params[it], null) && !Object.is(params[it], '')) {
      formData.append(it, params[it])
    }
  }
  return formData
}

// function fromData (params) {
//   var data = qs.stringify(params)
//   return data
// }
